示例#1
0
 public static function getInstance()
 {
     if (empty(self::$instance)) {
         self::$instance = new Database_Config_Bible();
     }
     return self::$instance;
 }
示例#2
0
文件: usfm.php 项目: alerque/bibledit
 public function __construct($bible)
 {
     $database_config_bible = Database_Config_Bible::getInstance();
     $database_styles = Database_Styles::getInstance();
     $stylesheet = $database_config_bible->getExportStylesheet($bible);
     $this->markersStylesheet = $database_styles->getMarkers($stylesheet);
     $styles_logic = Styles_Logic::getInstance();
     foreach ($this->markersStylesheet as $marker) {
         $style = $database_styles->getMarkerData($stylesheet, $marker);
         $requiredEndmarker = false;
         $styleType = $style['type'];
         $styleSubtype = $style['subtype'];
         if ($styleType == StyleTypeFootEndNote) {
             if ($styleSubtype == FootEndNoteSubtypeFootnote || $styleSubtype == FootEndNoteSubtypeEndnote) {
                 $requiredEndmarker = true;
             }
         }
         if ($styleType == StyleTypeCrossreference) {
             if ($styleSubtype == CrossreferenceSubtypeCrossreference) {
                 $requiredEndmarker = true;
             }
         }
         if ($styleType == StyleTypeInlineText) {
             $requiredEndmarker = true;
         }
         if ($styleType == StyleTypeWordlistElement) {
             $requiredEndmarker = true;
         }
         if ($requiredEndmarker) {
             $this->markersRequiringEndmarkers[] = $marker;
         }
     }
 }
示例#3
0
 public static function verses($bible, $book, $chapter, $verses)
 {
     // Get verses in this chapter according to the versification system for the Bible.
     $database_versifications = Database_Versifications::getInstance();
     $database_config_bible = Database_Config_Bible::getInstance();
     $versification = $database_config_bible->getVersificationSystem($bible);
     $standardVerses = $database_versifications->getVerses($versification, $book, $chapter);
     // Look for missing and extra verses.
     $absentVerses = array_diff($standardVerses, $verses);
     $extraVerses = array_diff($verses, $standardVerses);
     $database_check = Database_Check::getInstance();
     foreach ($absentVerses as $verse) {
         $database_check->recordOutput($bible, $book, $chapter, $verse, "This verse is missing according to the versification system");
     }
     foreach ($extraVerses as $verse) {
         //if (($chapter == 0) && ($verse == 0)) continue;
         $database_check->recordOutput($bible, $book, $chapter, $verse, "This verse is extra according to the versification system");
     }
     // Look for verses out of order.
     $previousVerse = 0;
     foreach ($verses as $key => $verse) {
         if ($key > 0) {
             if ($verse != $previousVerse + 1) {
                 $database_check->recordOutput($bible, $book, $chapter, $verse, "The verse is out of sequence");
             }
         }
         $previousVerse = $verse;
     }
 }
示例#4
0
文件: text.php 项目: alerque/bibledit
 public function __construct($bible)
 {
     $this->bible = $bible;
     $this->currentParagraphStyle = "";
     $this->currentParagraphContent = "";
     $this->currentTextStyle = array();
     $this->frameCount = 0;
     $this->noteCount = 0;
     $this->currentNoteTextStyle = array();
     $database_config_general = Database_Config_General::getInstance();
     $database_config_bible = Database_Config_Bible::getInstance();
     $template = dirname(__FILE__) . "/template.odt";
     $this->unpackedOdtFolder = Filter_Archive::unzip($template, false);
     Filter_Rmdir::rmdir($this->unpackedOdtFolder . "/Configurations2");
     $this->contentDom = new DOMDocument();
     $this->contentDom->load($this->unpackedOdtFolder . "/content.xml");
     $contentXpath = new DOMXpath($this->contentDom);
     $this->officeTextDomNode = $contentXpath->query("office:body/office:text")->item(0);
     // Remove the default content from the template. This is a text:p element.
     $node = $contentXpath->query("text:p", $this->officeTextDomNode)->item(0);
     $this->officeTextDomNode->removeChild($node);
     $this->createdStyles = array();
     $this->stylesDom = new DOMDocument();
     $this->stylesDom->load($this->unpackedOdtFolder . "/styles.xml");
     $stylesXpath = new DOMXpath($this->stylesDom);
     $this->officeStylesDomNode = $stylesXpath->query("office:styles")->item(0);
     // Set the page size and margins.
     $pageLayoutProperties = $stylesXpath->query("descendant::style:page-layout-properties")->item(0);
     $pageLayoutProperties->setAttribute("fo:page-width", $database_config_bible->getPageWidth($this->bible) . "mm");
     $pageLayoutProperties->setAttribute("fo:page-height", $database_config_bible->getPageHeight($this->bible) . "mm");
     $pageLayoutProperties->setAttribute("fo:margin-left", $database_config_bible->getInnerMargin($this->bible) . "mm");
     $pageLayoutProperties->setAttribute("fo:margin-right", $database_config_bible->getOuterMargin($this->bible) . "mm");
     $pageLayoutProperties->setAttribute("fo:margin-top", $database_config_bible->getTopMargin($this->bible) . "mm");
     $pageLayoutProperties->setAttribute("fo:margin-bottom", $database_config_bible->getBottomMargin($this->bible) . "mm");
     // Update the tab-stops in the relevant header styles. The tab stops depend on page and margin dimensions.
     $nodeList = $stylesXpath->query("descendant::style:style[contains(attribute::style:parent-style-name,'Header')]//descendant::style:tab-stop");
     $centerPosition = $database_config_bible->getPageWidth($this->bible) - $database_config_bible->getInnerMargin($this->bible) - $database_config_bible->getOuterMargin($this->bible);
     $centerPosition /= 2;
     $counter = 0;
     foreach ($nodeList as $node) {
         $modulus = $counter % 2;
         $node->setAttribute("style:position", $centerPosition * ($modulus + 1) . "mm");
         $counter++;
     }
     // Remove the date style for the running headers, so that it takes the default style.
     $numberDateStyleNode = $stylesXpath->query("descendant::number:date-style")->item(0);
     $numberDateStyleNode->parentNode->removeChild($numberDateStyleNode);
     // Whether and how to put the date in the running headers.
     $nodeList = $stylesXpath->query("descendant::text:date");
     foreach ($nodeList as $node) {
         if ($database_config_bible->getDateInHeader($this->bible)) {
             $node->removeAttribute("text:date-value");
             $node->nodeValue = "";
         } else {
             $node->parentNode->removeChild($node);
         }
     }
 }
示例#5
0
 /**
  * Creates book template with ID $book in Bible $bible.
  * If a $chapter is given instead of NULL, it creates that chapter only.
  */
 public static function create($bible, $book, $chapter, &$feedback)
 {
     $database_bibles = Database_Bibles::getInstance();
     $database_versifications = Database_Versifications::getInstance();
     $database_books = Database_Books::getInstance();
     $database_logs = Database_Logs::getInstance();
     $database_config_bible = Database_Config_Bible::getInstance();
     $bible_id = $database_bibles->getID($bible);
     if ($bible_id == 0) {
         $feedback[] = Locale_Translate::_("Bible {$bible} does not exist: Cannot create book");
         return false;
     }
     if ($book == 0) {
         $feedback[] = Locale_Translate::_("Invalid book while creating a book template");
         return false;
     }
     // The chapters that have been created.
     $chaptersCreated = array();
     // Chapter 0.
     if (!isset($chapter) || $chapter == 0) {
         $data = "\\id " . $database_books->getUsfmFromId($book) . "\n";
         $data .= "\\h " . $database_books->getEnglishFromId($book) . "\n";
         $data .= "\\toc2 " . $database_books->getEnglishFromId($book) . "\n";
         Bible_Logic::storeChapter($bible, $book, 0, $data);
         $chaptersCreated[] = 0;
     }
     // Subsequent chapters.
     $versification = $database_config_bible->getVersificationSystem($bible);
     $versification_data = $database_versifications->getBooksChaptersVerses($versification);
     foreach ($versification_data as $row) {
         if ($book == $row["book"]) {
             $ch = $row["chapter"];
             $verse = $row["verse"];
             if (!isset($chapter) || $chapter == $ch) {
                 $data = "\\c {$ch}\n";
                 $data .= "\\p\n";
                 for ($i = 1; $i <= $verse; $i++) {
                     $data .= "\\v {$i}\n";
                 }
                 Bible_Logic::storeChapter($bible, $book, $ch, $data);
                 $chaptersCreated[] = $ch;
             }
         }
     }
     // Done.
     if (count($chaptersCreated) == 0) {
         $feedback[] = Locale_Translate::_("No chapters have been craeted");
         return false;
     }
     $chaptersCreated = implode(" ", $chaptersCreated);
     $feedback[] = Locale_Translate::_("The following chapters have been created:") . " " . $chaptersCreated;
     return true;
 }
示例#6
0
文件: diff.php 项目: alerque/bibledit
 /**
  * This filter produces files in USFM, html and text format.
  * The text files are to be used for showing the differences between them.
  * The files contain all verses that differ.
  * $bible: The Bible to go through.
  * $directory: The existing directory where to put the files.
  * Two files are created: verses_old.usfm and verses_new.usfm.
  * The book chapter.verse precede each verse.
  */
 public static function produceVerseLevel($bible, $directory)
 {
     $database_bibles = Database_Bibles::getInstance();
     $database_modifications = Database_Modifications::getInstance();
     $database_books = Database_Books::getInstance();
     $database_config_bible = Database_Config_Bible::getInstance();
     $stylesheet = $database_config_bible->getExportStylesheet($bible);
     $old_vs_usfm = array();
     $new_vs_usfm = array();
     $filter_text_old = new Filter_Text($bible);
     $filter_text_old->html_text_standard = new Html_Text(Locale_Translate::_("Bible"));
     $filter_text_old->text_text = new Text_Text();
     $filter_text_new = new Filter_Text($bible);
     $filter_text_new->html_text_standard = new Html_Text(Locale_Translate::_("Bible"));
     $filter_text_new->text_text = new Text_Text();
     $books = $database_modifications->getTeamDiffBooks($bible);
     foreach ($books as $book) {
         $bookname = $database_books->getEnglishFromId($book);
         $chapters = $database_modifications->getTeamDiffChapters($bible, $book);
         foreach ($chapters as $chapter) {
             // Go through the combined verse numbers in the old and new chapter.
             $old_chapter_usfm = $database_modifications->getTeamDiff($bible, $book, $chapter);
             $new_chapter_usfm = $database_bibles->getChapter($bible, $book, $chapter);
             $old_verse_numbers = Filter_Usfm::getVerseNumbers($old_chapter_usfm);
             $new_verse_numbers = Filter_Usfm::getVerseNumbers($new_chapter_usfm);
             $verses = array_merge($old_verse_numbers, $new_verse_numbers);
             $verses = array_unique($verses);
             sort($verses, SORT_NUMERIC);
             foreach ($verses as $verse) {
                 $old_verse_text = Filter_Usfm::getVerseText($old_chapter_usfm, $verse);
                 $new_verse_text = Filter_Usfm::getVerseText($new_chapter_usfm, $verse);
                 if ($old_verse_text != $new_verse_text) {
                     $usfmCode = "\\p {$bookname} {$chapter}.{$verse} {$old_verse_text}";
                     $old_vs_usfm[] = $usfmCode;
                     $filter_text_old->addUsfmCode($usfmCode);
                     $usfmCode = "\\p {$bookname} {$chapter}.{$verse} {$new_verse_text}";
                     $new_vs_usfm[] = $usfmCode;
                     $filter_text_new->addUsfmCode($usfmCode);
                 }
             }
         }
     }
     file_put_contents("{$directory}/verses_old.usfm", implode("\n", $old_vs_usfm));
     file_put_contents("{$directory}/verses_new.usfm", implode("\n", $new_vs_usfm));
     $filter_text_old->run($stylesheet);
     $filter_text_new->run($stylesheet);
     $filter_text_old->html_text_standard->save("{$directory}/verses_old.html");
     $filter_text_new->html_text_standard->save("{$directory}/verses_new.html");
     $filter_text_old->text_text->save("{$directory}/verses_old.txt");
     $filter_text_new->text_text->save("{$directory}/verses_new.txt");
 }
示例#7
0
 public static function getHtml($resource, $book, $chapter, $verse)
 {
     $database_bibles = Database_Bibles::getInstance();
     $database_resources = Database_Resources::getInstance();
     $database_usfmresources = Database_UsfmResources::getInstance();
     $database_offlineresources = Database_OfflineResources::getInstance();
     $database_mappings = Database_Mappings::getInstance();
     $database_config_user = Database_Config_User::getInstance();
     $database_config_bible = Database_Config_Bible::getInstance();
     $bibles = $database_bibles->getBibles();
     $usfms = $database_usfmresources->getResources();
     $externals = $database_resources->getNames();
     $isBible = in_array($resource, $bibles);
     $isUsfm = in_array($resource, $usfms);
     if ($isBible || $isUsfm) {
         if ($isBible) {
             $chapter_usfm = $database_bibles->getChapter($resource, $book, $chapter);
         }
         if ($isUsfm) {
             $chapter_usfm = $database_usfmresources->getUsfm($resource, $book, $chapter);
         }
         $verse_usfm = Filter_Usfm::getVerseText($chapter_usfm, $verse);
         $database_config_user = Database_Config_User::getInstance();
         $stylesheet = $database_config_user->getStylesheet();
         $filter_text = new Filter_Text($resource);
         $filter_text->html_text_standard = new Html_Text(Locale_Translate::_("Bible"));
         $filter_text->addUsfmCode($verse_usfm);
         $filter_text->run($stylesheet);
         $html = $filter_text->html_text_standard->getInnerHtml();
     } else {
         if (in_array($resource, $externals)) {
             // Use offline copy if it exists, else fetch it online.
             if ($database_offlineresources->exists($resource, $book, $chapter, $verse)) {
                 $bible = $database_config_user->getBible();
                 $bible_mapping = $database_config_bible->getVerseMapping($bible);
                 $resource_mapping = $database_resources->getMapping($resource);
                 $passages = $database_mappings->translate($bible_mapping, $resource_mapping, $book, $chapter, $verse);
                 $html = "";
                 foreach ($passages as $passage) {
                     $html .= $database_offlineresources->get($resource, $passage[0], $passage[1], $passage[2]);
                 }
             } else {
                 $html = Resource_Logic::getExternal($resource, $book, $chapter, $verse, true);
             }
         } else {
             $html = "";
         }
     }
     return $html;
 }
示例#8
0
    public function testOne()
    {
        $database_config_bible = Database_Config_Bible::getInstance();
        $database_config_bible->setExportChapterDropCapsFrames("phpunit", true);
        $usfm = <<<'EOD'
\id GEN
\h Header
\h1 Header1
\h2 Header2
\h3 Header3
\toc1 The Book of Genesis
\toc2 Genesis
\toc3 Gen
\cl Chapter
\c 1
\cp Ⅰ
\p
\v 1 Text chapter 1
\c 2
\cp ②
\h Header4
\p
\v 2 Text chapter 2
EOD;
        $filter_text = new Filter_Text("phpunit");
        $filter_text->odf_text_standard = new Odf_Text("phpunit");
        $filter_text->addUsfmCode($usfm);
        $filter_text->run("Standard");
        // Check that it finds the running headers.
        $this->assertEquals(array('book' => 1, 'chapter' => 0, 'verse' => 0, 'marker' => 'h', 'value' => 'Header'), $filter_text->runningHeaders[0]);
        $this->assertEquals(array('book' => 1, 'chapter' => 0, 'verse' => 0, 'marker' => 'h1', 'value' => 'Header1'), $filter_text->runningHeaders[1]);
        $this->assertEquals(array('book' => 1, 'chapter' => 0, 'verse' => 0, 'marker' => 'h2', 'value' => 'Header2'), $filter_text->runningHeaders[2]);
        $this->assertEquals(array('book' => 1, 'chapter' => 0, 'verse' => 0, 'marker' => 'h3', 'value' => 'Header3'), $filter_text->runningHeaders[3]);
        $this->assertEquals(array('book' => 1, 'chapter' => 2, 'verse' => 0, 'marker' => 'h', 'value' => 'Header4'), $filter_text->runningHeaders[4]);
        // Check on Table of Contents items.
        $this->assertEquals(array('book' => 1, 'chapter' => 0, 'verse' => 0, 'marker' => 'toc1', 'value' => 'The Book of Genesis'), $filter_text->longTOCs[0]);
        $this->assertEquals(array('book' => 1, 'chapter' => 0, 'verse' => 0, 'marker' => 'toc2', 'value' => 'Genesis'), $filter_text->shortTOCs[0]);
        // Check book abbreviation.
        $this->assertEquals(array('book' => 1, 'chapter' => 0, 'verse' => 0, 'marker' => 'toc3', 'value' => 'Gen'), $filter_text->bookAbbreviations[0]);
        // Check chapter specials.
        $this->assertEquals(array('book' => 1, 'chapter' => 0, 'verse' => 0, 'marker' => 'cl', 'value' => 'Chapter'), $filter_text->chapterLabels[0]);
        $this->assertEquals(array('book' => 1, 'chapter' => 1, 'verse' => 0, 'marker' => 'cp', 'value' => 'Ⅰ'), $filter_text->publishedChapterMarkers[0]);
        $this->assertEquals(array('book' => 1, 'chapter' => 2, 'verse' => 0, 'marker' => 'cp', 'value' => '②'), $filter_text->publishedChapterMarkers[1]);
        $this->assertEquals(array(1 => 2), $filter_text->numberOfChaptersPerBook);
        $filter_text->odf_text_standard->save("/tmp/TextTest.odt");
        exec("odt2txt /tmp/TextTest.odt", $output, $return_var);
        $this->assertEquals(array("", "Header4 Ⅰ", "=========", "", "[-- Image: frame1 --]", "", "Ⅰ", "", "Text chapter 1", "", "Header4 ②", "=========", "", "[-- Image: frame2 --]", "", "②", "", "Text chapter 2", ""), $output);
    }
示例#9
0
 public function testVersificationMapping()
 {
     $database_config_bible = Database_Config_Bible::getInstance();
     $versification = $database_config_bible->getVersificationSystem("phpunit");
     $this->assertEquals("English", $versification);
     $mapping = $database_config_bible->getVerseMapping("phpunit");
     $this->assertEquals("English", $mapping);
     $versification = $database_config_bible->getVersificationSystem("x");
     $this->assertEquals("English", $versification);
     $mapping = $database_config_bible->getVerseMapping("x");
     $this->assertEquals("English", $mapping);
     $database_config_bible->setVersificationSystem("phpunit", "VersificatioN");
     $versification = $database_config_bible->getVersificationSystem("phpunit");
     $this->assertEquals("VersificatioN", $versification);
     $database_config_bible->setVerseMapping("phpunit", "VersificatioN");
     $mapping = $database_config_bible->getVerseMapping("phpunit");
     $this->assertEquals("VersificatioN", $mapping);
 }
示例#10
0
 public static function read($bible, $user = "")
 {
     // Client: User has access to all Bibles.
     if (Filter_Client::enabled()) {
         return true;
     }
     if ($user == "") {
         $session_logic = Session_Logic::getInstance();
         $user = $session_logic->currentUser();
     }
     $database_users = Database_Users::getInstance();
     if ($database_users->hasAccess2Bible($user, $bible)) {
         return true;
     }
     $database_config_bible = Database_Config_Bible::getInstance();
     if ($database_config_bible->getViewableByAllUsers($bible)) {
         return true;
     }
     return false;
 }
示例#11
0
 public static function getOrdered($bible)
 {
     $database_bibles = Database_Bibles::getInstance();
     $database_config_bible = Database_Config_Bible::getInstance();
     // The available books from the Bible.
     $projectbooks = $database_bibles->getBooks($bible);
     // The book order from the settings, if any.
     $orderedbooks = $database_config_bible->getBookOrder($bible);
     $orderedbooks = explode(" ", $orderedbooks);
     // Remove books not available in the Bible.
     $orderedbooks = array_intersect($orderedbooks, $projectbooks);
     // Books in the Bible but not in the settings: Add them to the end.
     $orderedbooks = array_merge($orderedbooks, $projectbooks);
     $orderedbooks = array_unique($orderedbooks);
     $orderedbooks = array_values($orderedbooks);
     return $orderedbooks;
 }
示例#12
0
文件: text.php 项目: alerque/bibledit
 /**
  * This function does the processing of the USFM code,
  * formatting the document and extracting other useful information.
  */
 private function processUsfm()
 {
     // Go through the USFM code.
     $processedBooksCount = 0;
     $this->usfmMarkersAndTextPointer = 0;
     while ($this->unprocessedUsfmCodeAvailable()) {
         $this->getUsfmNextChapter();
         for ($this->chapterUsfmMarkersAndTextPointer = 0; $this->chapterUsfmMarkersAndTextPointer < count($this->chapterUsfmMarkersAndText); $this->chapterUsfmMarkersAndTextPointer++) {
             $currentItem = $this->chapterUsfmMarkersAndText[$this->chapterUsfmMarkersAndTextPointer];
             if (Filter_Usfm::isUsfmMarker($currentItem)) {
                 // Indicator describing the marker.
                 $isOpeningMarker = Filter_Usfm::isOpeningMarker($currentItem);
                 $isEmbeddedMarker = Filter_Usfm::isEmbeddedMarker($currentItem);
                 // Clean up the marker, so we remain with the basic version, e.g. 'id'.
                 $marker = Filter_Usfm::getMarker($currentItem);
                 if (array_key_exists($marker, $this->styles)) {
                     $style = $this->styles[$marker];
                     switch ($style['type']) {
                         case StyleTypeIdentifier:
                             if ($this->odf_text_standard) {
                                 $this->odf_text_standard->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_text_only) {
                                 $this->odf_text_text_only->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_text_and_note_citations) {
                                 $this->odf_text_text_and_note_citations->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_notes) {
                                 $this->odf_text_notes->closeTextStyle(false, false);
                             }
                             if ($this->html_text_standard) {
                                 $this->html_text_standard->closeTextStyle(false, false);
                             }
                             if ($this->html_text_linked) {
                                 $this->html_text_linked->closeTextStyle(false, false);
                             }
                             switch ($style['subtype']) {
                                 case IdentifierSubtypeBook:
                                     // Get book number.
                                     $s = Filter_Usfm::getBookIdentifier($this->chapterUsfmMarkersAndText, $this->chapterUsfmMarkersAndTextPointer);
                                     $s = str_replace(Filter_Character::softHyphen(), "", $s);
                                     // Remove possible soft hyphen.
                                     $database_books = Database_Books::getInstance();
                                     $this->currentBookIdentifier = $database_books->getIdFromUsfm($s);
                                     // Reset chapter and verse numbers.
                                     $this->currentChapterNumber = 0;
                                     $this->currentVerseNumber = "0";
                                     // Throw away whatever follows the \id, e.g. 'GEN xxx xxx'.
                                     Filter_Usfm::getTextFollowingMarker($this->chapterUsfmMarkersAndText, $this->chapterUsfmMarkersAndTextPointer);
                                     // Whether to insert a new page before the book. But never before the first book.
                                     if ($style['userbool1']) {
                                         if ($processedBooksCount) {
                                             if ($this->odf_text_standard) {
                                                 $this->odf_text_standard->newPageBreak();
                                             }
                                             if ($this->odf_text_text_only) {
                                                 $this->odf_text_text_only->newPageBreak();
                                             }
                                             if ($this->odf_text_text_and_note_citations) {
                                                 $this->odf_text_text_and_note_citations->newPageBreak();
                                             }
                                             if ($this->html_text_standard) {
                                                 $this->html_text_standard->newPageBreak();
                                             }
                                             if ($this->html_text_linked) {
                                                 $this->html_text_linked->newPageBreak();
                                             }
                                         }
                                     }
                                     $processedBooksCount++;
                                     // Reset notes.
                                     $this->resetNoteCitations('book');
                                     // Online Bible.
                                     if ($this->onlinebible_text) {
                                         $this->onlinebible_text->storeData();
                                     }
                                     // eSword.
                                     if ($this->esword_text) {
                                         $this->esword_text->newBook($this->currentBookIdentifier);
                                     }
                                     // Done.
                                     break;
                                 case IdentifierSubtypeEncoding:
                                     $this->addToFallout("Text encoding indicator not supported. Encoding is always in UTF8: \\{$marker}", true);
                                     break;
                                 case IdentifierSubtypeComment:
                                     $this->addToInfo("Comment: \\{$marker}", true);
                                     break;
                                 case IdentifierSubtypeRunningHeader:
                                     // This information already went into the Info document during the preprocessing stage.
                                     // Remove it from the USFM input stream.
                                     Filter_Usfm::getTextFollowingMarker($this->chapterUsfmMarkersAndText, $this->chapterUsfmMarkersAndTextPointer);
                                     // Ideally this information should be inserted in the headers of the standard text document.
                                     // UserBool2RunningHeaderLeft:
                                     // UserBool3RunningHeaderRight:
                                     break;
                                 case IdentifierSubtypeLongTOC:
                                     // This information already went into the Info document. Remove it from the USFM stream.
                                     Filter_Usfm::getTextFollowingMarker($this->chapterUsfmMarkersAndText, $this->chapterUsfmMarkersAndTextPointer);
                                     break;
                                 case IdentifierSubtypeShortTOC:
                                     // This information already went into the Info document. Remove it from the USFM stream.
                                     Filter_Usfm::getTextFollowingMarker($this->chapterUsfmMarkersAndText, $this->chapterUsfmMarkersAndTextPointer);
                                     break;
                                 case IdentifierSubtypeBookAbbrev:
                                     // This information already went into the Info document. Remove it from the USFM stream.
                                     Filter_Usfm::getTextFollowingMarker($this->chapterUsfmMarkersAndText, $this->chapterUsfmMarkersAndTextPointer);
                                     break;
                                 case IdentifierSubtypeChapterLabel:
                                     // This information is already in the object. Remove it from the USFM stream.
                                     Filter_Usfm::getTextFollowingMarker($this->chapterUsfmMarkersAndText, $this->chapterUsfmMarkersAndTextPointer);
                                     break;
                                 case IdentifierSubtypePublishedChapterMarker:
                                     // This information is already in the object. Remove it from the USFM stream.
                                     Filter_Usfm::getTextFollowingMarker($this->chapterUsfmMarkersAndText, $this->chapterUsfmMarkersAndTextPointer);
                                     break;
                                 case IdentifierSubtypeCommentWithEndmarker:
                                     if ($isOpeningMarker) {
                                         $this->addToInfo("Comment: \\{$marker}", true);
                                     }
                                     break;
                                 default:
                                     $this->addToFallout("Unknown markup: \\{$marker}", true);
                                     break;
                             }
                             break;
                         case StyleTypeNotUsedComment:
                             $this->addToFallout("Unknown markup: \\{$marker}", true);
                             break;
                         case StyleTypeNotUsedRunningHeader:
                             $this->addToFallout("Unknown markup: \\{$marker}", true);
                             break;
                         case StyleTypeStartsParagraph:
                             if ($this->odf_text_standard) {
                                 $this->odf_text_standard->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_text_only) {
                                 $this->odf_text_text_only->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_text_and_note_citations) {
                                 $this->odf_text_text_and_note_citations->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_notes) {
                                 $this->odf_text_notes->closeTextStyle(false, false);
                             }
                             if ($this->html_text_standard) {
                                 $this->html_text_standard->closeTextStyle(false, false);
                             }
                             if ($this->html_text_linked) {
                                 $this->html_text_linked->closeTextStyle(false, false);
                             }
                             switch ($style['subtype']) {
                                 case ParagraphSubtypeMainTitle:
                                 case ParagraphSubtypeSubTitle:
                                 case ParagraphSubtypeSectionHeading:
                                     $this->newParagraph($style, true);
                                     $this->heading_started = true;
                                     $this->text_started = false;
                                     break;
                                 case ParagraphSubtypeNormalParagraph:
                                 default:
                                     $this->newParagraph($style, false);
                                     $this->heading_started = false;
                                     $this->text_started = true;
                                     if (is_array($this->verses_text)) {
                                         // If a new paragraph starts within an existing verse,
                                         // add a space to the text already in that verse.
                                         if (isset($this->verses_text[$this->currentVerseNumber])) {
                                             $this->verses_text[$this->currentVerseNumber] .= " ";
                                         }
                                         // Record the position within the text where this new paragraph starts.
                                         $contents = implode('', $this->verses_text);
                                         $this->paragraph_start_positions[] = mb_strlen($contents);
                                         unset($contents);
                                     }
                                     break;
                             }
                             break;
                         case StyleTypeInlineText:
                             // Support for a normal and an embedded character style.
                             if ($isOpeningMarker) {
                                 if ($this->odf_text_standard) {
                                     $this->odf_text_standard->openTextStyle($style, false, $isEmbeddedMarker);
                                 }
                                 if ($this->odf_text_text_only) {
                                     $this->odf_text_text_only->openTextStyle($style, false, $isEmbeddedMarker);
                                 }
                                 if ($this->odf_text_text_and_note_citations) {
                                     $this->odf_text_text_and_note_citations->openTextStyle($style, false, $isEmbeddedMarker);
                                 }
                                 if ($this->html_text_standard) {
                                     $this->html_text_standard->openTextStyle($style, false, $isEmbeddedMarker);
                                 }
                                 if ($this->html_text_linked) {
                                     $this->html_text_linked->openTextStyle($style, false, $isEmbeddedMarker);
                                 }
                             } else {
                                 if ($this->odf_text_standard) {
                                     $this->odf_text_standard->closeTextStyle(false, $isEmbeddedMarker);
                                 }
                                 if ($this->odf_text_text_only) {
                                     $this->odf_text_text_only->closeTextStyle(false, $isEmbeddedMarker);
                                 }
                                 if ($this->odf_text_text_and_note_citations) {
                                     $this->odf_text_text_and_note_citations->closeTextStyle(false, $isEmbeddedMarker);
                                 }
                                 if ($this->html_text_standard) {
                                     $this->html_text_standard->closeTextStyle(false, $isEmbeddedMarker);
                                 }
                                 if ($this->html_text_linked) {
                                     $this->html_text_linked->closeTextStyle(false, $isEmbeddedMarker);
                                 }
                             }
                             break;
                         case StyleTypeChapterNumber:
                             if ($this->odf_text_standard) {
                                 $this->odf_text_standard->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_text_only) {
                                 $this->odf_text_text_only->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_text_and_note_citations) {
                                 $this->odf_text_text_and_note_citations->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_notes) {
                                 $this->odf_text_notes->closeTextStyle(false, false);
                             }
                             if ($this->html_text_standard) {
                                 $this->html_text_standard->closeTextStyle(false, false);
                             }
                             if ($this->html_text_linked) {
                                 $this->html_text_linked->closeTextStyle(false, false);
                             }
                             if ($this->onlinebible_text) {
                                 $this->onlinebible_text->storeData();
                             }
                             // Get the chapter number.
                             $number = Filter_Usfm::getTextFollowingMarker($this->chapterUsfmMarkersAndText, $this->chapterUsfmMarkersAndTextPointer);
                             $number = Filter_Numeric::integer_in_string($number);
                             // Update this object.
                             $this->currentChapterNumber = $number;
                             $this->currentVerseNumber = "0";
                             // If there is a published chapter character, the chapter number takes that value.
                             foreach ($this->publishedChapterMarkers as $publishedChapterMarker) {
                                 if ($publishedChapterMarker['book'] == $this->currentBookIdentifier) {
                                     if ($publishedChapterMarker['chapter'] == $this->currentChapterNumber) {
                                         $number = $publishedChapterMarker['value'];
                                     }
                                 }
                             }
                             // Enter text for the running headers.
                             $database_books = Database_Books::getInstance();
                             $runningHeader = $database_books->getEnglishFromId($this->currentBookIdentifier);
                             foreach ($this->runningHeaders as $item) {
                                 if ($item['book'] == $this->currentBookIdentifier) {
                                     $runningHeader = $item['value'];
                                 }
                             }
                             $runningHeader = "{$runningHeader} {$number}";
                             if ($this->odf_text_standard) {
                                 $this->odf_text_standard->newHeading1($runningHeader, true);
                             }
                             if ($this->odf_text_text_only) {
                                 $this->odf_text_text_only->newHeading1($runningHeader, true);
                             }
                             if ($this->odf_text_text_and_note_citations) {
                                 $this->odf_text_text_and_note_citations->newHeading1($runningHeader, true);
                             }
                             if ($this->odf_text_notes) {
                                 $this->odf_text_notes->newHeading1($runningHeader, false);
                             }
                             // This is the phase of outputting the chapter number in the text body.
                             // It always outputs the chapter number to the clear text export.
                             if (isset($this->text_text)) {
                                 $this->text_text->paragraph($number);
                             }
                             // The chapter number is only output when there is more than one chapter in a book.
                             if ($this->numberOfChaptersPerBook[$this->currentBookIdentifier] > 1) {
                                 if ($style['userbool1']) {
                                     // Output the chapter number at the first verse, not here.
                                     // Store it for later processing.
                                     $this->outputChapterTextAtFirstVerse = $number;
                                 } else {
                                     // Output the chapter in a new paragraph.
                                     // If the chapter label \cl is entered once before chapter 1 (\c 1)
                                     // it represents the text for "chapter" to be used throughout the current book.
                                     // If \cl is used after each individual chapter marker, it represents the particular text
                                     // to be used for the display of the current chapter heading
                                     // (usually done if numbers are being presented as words, not numerals).
                                     $labelEntireBook = "";
                                     $labelCurrentChapter = "";
                                     foreach ($this->chapterLabels as $pchapterLabel) {
                                         if ($pchapterLabel['book'] == $this->currentBookIdentifier) {
                                             if ($pchapterLabel['chapter'] == 0) {
                                                 $labelEntireBook = $pchapterLabel['value'];
                                             }
                                             if ($pchapterLabel['chapter'] == $this->currentChapterNumber) {
                                                 $labelCurrentChapter = $pchapterLabel['value'];
                                             }
                                         }
                                     }
                                     if ($labelEntireBook != "") {
                                         $number = "{$labelEntireBook} {$number}";
                                     }
                                     if ($labelCurrentChapter != "") {
                                         $number = $labelCurrentChapter;
                                     }
                                     // The chapter number shows in a new paragraph.
                                     // Keep it together with the next paragraph.
                                     $this->newParagraph($style, true);
                                     if ($this->odf_text_standard) {
                                         $this->odf_text_standard->addText($number);
                                     }
                                     if ($this->odf_text_text_only) {
                                         $this->odf_text_text_only->addText($number);
                                     }
                                     if ($this->odf_text_text_and_note_citations) {
                                         $this->odf_text_text_and_note_citations->addText($number);
                                     }
                                     if ($this->html_text_standard) {
                                         $this->html_text_standard->addText($number);
                                     }
                                     if ($this->html_text_linked) {
                                         $this->html_text_linked->addText($number);
                                     }
                                 }
                             }
                             // Output chapter number for other formats.
                             if ($this->esword_text) {
                                 $this->esword_text->newChapter($this->currentChapterNumber);
                             }
                             // Open a paragraph for the notes. It takes the style of the footnote content marker, usually 'ft'.
                             // This is done specifically for the version that has the notes only.
                             $this->ensureNoteParagraphStyle($this->standardContentMarkerFootEndNote, $this->styles[$this->standardContentMarkerFootEndNote]);
                             if ($this->odf_text_notes) {
                                 $this->odf_text_notes->newParagraph($this->standardContentMarkerFootEndNote);
                             }
                             // UserBool2ChapterInLeftRunningHeader -> no headings implemented yet.
                             // UserBool3ChapterInRightRunningHeader -> no headings implemented yet.
                             // Reset.
                             $this->resetNoteCitations('chapter');
                             // Done.
                             break;
                         case StyleTypeVerseNumber:
                             if ($this->odf_text_standard) {
                                 $this->odf_text_standard->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_text_only) {
                                 $this->odf_text_text_only->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_text_and_note_citations) {
                                 $this->odf_text_text_and_note_citations->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_notes) {
                                 $this->odf_text_notes->closeTextStyle(false, false);
                             }
                             if ($this->html_text_standard) {
                                 $this->html_text_standard->closeTextStyle(false, false);
                             }
                             if ($this->html_text_linked) {
                                 $this->html_text_linked->closeTextStyle(false, false);
                             }
                             if ($this->onlinebible_text) {
                                 $this->onlinebible_text->storeData();
                             }
                             // Care for the situation that a new verse starts a new paragraph.
                             if ($style['userbool1']) {
                                 if ($this->odf_text_standard) {
                                     if ($this->odf_text_standard->currentParagraphContent != "") {
                                         $this->odf_text_standard->newParagraph($this->odf_text_standard->currentParagraphStyle);
                                     }
                                 }
                                 if ($this->odf_text_text_only) {
                                     if ($this->odf_text_text_only->currentParagraphContent != "") {
                                         $this->odf_text_text_only->newParagraph($this->odf_text_text_only->currentParagraphStyle);
                                     }
                                 }
                                 if ($this->odf_text_text_and_note_citations) {
                                     if ($this->odf_text_text_and_note_citations->currentParagraphContent != "") {
                                         $this->odf_text_text_and_note_citations->newParagraph($this->odf_text_text_and_note_citations->currentParagraphStyle);
                                     }
                                 }
                                 if ($this->html_text_standard) {
                                     if ($this->html_text_standard->currentParagraphContent != "") {
                                         $this->html_text_standard->newParagraph($this->html_text_standard->currentParagraphStyle);
                                     }
                                 }
                                 if ($this->html_text_linked) {
                                     if ($this->html_text_linked->currentParagraphContent != "") {
                                         $this->html_text_linked->newParagraph($this->html_text_linked->currentParagraphStyle);
                                     }
                                 }
                                 if (isset($this->text_text)) {
                                     $this->text_text->paragraph();
                                 }
                             }
                             // Deal with the case of a pending chapter number.
                             if (isset($this->outputChapterTextAtFirstVerse)) {
                                 $database_config_bible = Database_Config_Bible::getInstance();
                                 if (!$database_config_bible->getExportChapterDropCapsFrames($this->bible)) {
                                     $dropCapsLength = mb_strlen($this->outputChapterTextAtFirstVerse);
                                     $this->applyDropCapsToCurrentParagraph($dropCapsLength);
                                     if ($this->odf_text_standard) {
                                         $this->odf_text_standard->addText($this->outputChapterTextAtFirstVerse);
                                     }
                                     if ($this->odf_text_text_only) {
                                         $this->odf_text_text_only->addText($this->outputChapterTextAtFirstVerse);
                                     }
                                     if ($this->odf_text_text_and_note_citations) {
                                         $this->odf_text_text_and_note_citations->addText($this->outputChapterTextAtFirstVerse);
                                     }
                                 } else {
                                     $this->putChapterNumberInFrame($this->outputChapterTextAtFirstVerse);
                                 }
                                 if ($this->html_text_standard) {
                                     $this->html_text_standard->openTextStyle(array("marker" => "dropcaps"), false, false);
                                 }
                                 if ($this->html_text_standard) {
                                     $this->html_text_standard->addText($this->outputChapterTextAtFirstVerse);
                                 }
                                 if ($this->html_text_standard) {
                                     $this->html_text_standard->closeTextStyle(false, false);
                                 }
                                 if ($this->html_text_linked) {
                                     $this->html_text_linked->openTextStyle(array("marker" => "dropcaps"), false, false);
                                 }
                                 if ($this->html_text_linked) {
                                     $this->html_text_linked->addText($this->outputChapterTextAtFirstVerse);
                                 }
                                 if ($this->html_text_linked) {
                                     $this->html_text_linked->closeTextStyle(false, false);
                                 }
                             }
                             // Temporarily retrieve the text that follows the \v verse marker.
                             $textFollowingMarker = Filter_Usfm::getTextFollowingMarker($this->chapterUsfmMarkersAndText, $this->chapterUsfmMarkersAndTextPointer);
                             // Extract the verse number, and store it in the object.
                             $number = Filter_Usfm::peekVerseNumber($textFollowingMarker);
                             $this->currentVerseNumber = $number;
                             // Output the verse number. But only if no chapter number was put here.
                             if (!isset($this->outputChapterTextAtFirstVerse)) {
                                 // If the current paragraph has text already, then insert a space.
                                 if ($this->odf_text_standard) {
                                     if ($this->odf_text_standard->currentParagraphContent != "") {
                                         $this->odf_text_standard->addText(" ");
                                     }
                                 }
                                 if ($this->odf_text_text_only) {
                                     if ($this->odf_text_text_only->currentParagraphContent != "") {
                                         $this->odf_text_text_only->addText(" ");
                                     }
                                 }
                                 if ($this->odf_text_text_and_note_citations) {
                                     if ($this->odf_text_text_and_note_citations->currentParagraphContent != "") {
                                         $this->odf_text_text_and_note_citations->addText(" ");
                                     }
                                 }
                                 if ($this->html_text_standard) {
                                     if ($this->html_text_standard->currentParagraphContent != "") {
                                         $this->html_text_standard->addText(" ");
                                     }
                                 }
                                 if ($this->html_text_linked) {
                                     if ($this->html_text_linked->currentParagraphContent != "") {
                                         $this->html_text_linked->addText(" ");
                                     }
                                 }
                                 if ($this->odf_text_standard) {
                                     $this->odf_text_standard->openTextStyle($style, false, false);
                                 }
                                 if ($this->odf_text_text_only) {
                                     $this->odf_text_text_only->openTextStyle($style, false, false);
                                 }
                                 if ($this->odf_text_text_and_note_citations) {
                                     $this->odf_text_text_and_note_citations->openTextStyle($style, false, false);
                                 }
                                 if ($this->html_text_standard) {
                                     $this->html_text_standard->openTextStyle($style, false, false);
                                 }
                                 if ($this->html_text_linked) {
                                     $this->html_text_linked->openTextStyle($style, false, false);
                                 }
                                 if ($this->odf_text_standard) {
                                     $this->odf_text_standard->addText($number);
                                 }
                                 if ($this->odf_text_text_only) {
                                     $this->odf_text_text_only->addText($number);
                                 }
                                 if ($this->odf_text_text_and_note_citations) {
                                     $this->odf_text_text_and_note_citations->addText($number);
                                 }
                                 if ($this->html_text_standard) {
                                     $this->html_text_standard->addText($number);
                                 }
                                 if ($this->html_text_linked) {
                                     $this->html_text_linked->addText($number);
                                 }
                                 if ($this->odf_text_standard) {
                                     $this->odf_text_standard->closeTextStyle(false, false);
                                 }
                                 if ($this->odf_text_text_only) {
                                     $this->odf_text_text_only->closeTextStyle(false, false);
                                 }
                                 if ($this->odf_text_text_and_note_citations) {
                                     $this->odf_text_text_and_note_citations->closeTextStyle(false, false);
                                 }
                                 if ($this->html_text_standard) {
                                     $this->html_text_standard->closeTextStyle(false, false);
                                 }
                                 if ($this->html_text_linked) {
                                     $this->html_text_linked->closeTextStyle(false, false);
                                 }
                             }
                             // Clear text output.
                             if (isset($this->text_text)) {
                                 if ($this->text_text->line() != "") {
                                     $this->text_text->text(" ");
                                 }
                                 $this->text_text->text($number);
                                 // Clear text output always has a space following the verse.
                                 // Important for outputting the first verse.
                                 $this->text_text->text(" ");
                             }
                             // If there was any text following the \v marker, remove the verse number,
                             // put the remainder back into the object, and update the pointer.
                             if ($textFollowingMarker != "") {
                                 @($pos = strpos($textFollowingMarker, $number));
                                 if ($pos !== false) {
                                     $textFollowingMarker = substr($textFollowingMarker, $pos + strlen($number));
                                 }
                                 // If a chapter number was put, remove any whitespace from the start of the following text.
                                 // Remove whitespace from the start of the following text, and replace it with the en-space.
                                 // This en-space is a fixed-width space.
                                 // This type of space makes the layout of the text following the verse number look tidier.
                                 // But if a chapter number was put, than do not put any space at the start of the following verse.
                                 $textFollowingMarker = ltrim($textFollowingMarker);
                                 if (!isset($this->outputChapterTextAtFirstVerse)) {
                                     $textFollowingMarker = Filter_Character::enSpace() . $textFollowingMarker;
                                 }
                                 $this->chapterUsfmMarkersAndText[$this->chapterUsfmMarkersAndTextPointer] = $textFollowingMarker;
                                 $this->chapterUsfmMarkersAndTextPointer--;
                             }
                             // Unset the chapter variable, whether it was used or not. This makes it ready for subsequent use.
                             unset($this->outputChapterTextAtFirstVerse);
                             // Other export formats.
                             if ($this->onlinebible_text) {
                                 $this->onlinebible_text->newVerse($this->currentBookIdentifier, $this->currentChapterNumber, $this->currentVerseNumber);
                             }
                             if ($this->esword_text) {
                                 $this->esword_text->newVerse($this->currentVerseNumber);
                             }
                             // Done.
                             break;
                         case StyleTypeFootEndNote:
                             $this->processNote();
                             break;
                         case StyleTypeCrossreference:
                             $this->processNote();
                             break;
                         case StyleTypePeripheral:
                             if ($this->odf_text_standard) {
                                 $this->odf_text_standard->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_text_only) {
                                 $this->odf_text_text_only->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_text_and_note_citations) {
                                 $this->odf_text_text_and_note_citations->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_notes) {
                                 $this->odf_text_notes->closeTextStyle(false, false);
                             }
                             if ($this->html_text_standard) {
                                 $this->html_text_standard->closeTextStyle(false, false);
                             }
                             if ($this->html_text_linked) {
                                 $this->html_text_linked->closeTextStyle(false, false);
                             }
                             switch ($style['subtype']) {
                                 case PeripheralSubtypePublication:
                                 case PeripheralSubtypeTableOfContents:
                                 case PeripheralSubtypePreface:
                                 case PeripheralSubtypeIntroduction:
                                 case PeripheralSubtypeGlossary:
                                 case PeripheralSubtypeConcordance:
                                 case PeripheralSubtypeIndex:
                                 case PeripheralSubtypeMapIndex:
                                 case PeripheralSubtypeCover:
                                 case PeripheralSubtypeSpine:
                                 default:
                                     $this->addToFallout("Unknown pheripheral marker \\{$marker}", false);
                                     break;
                             }
                             break;
                         case StyleTypePicture:
                             if ($this->odf_text_standard) {
                                 $this->odf_text_standard->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_text_only) {
                                 $this->odf_text_text_only->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_text_and_note_citations) {
                                 $this->odf_text_text_and_note_citations->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_notes) {
                                 $this->odf_text_notes->closeTextStyle(false, false);
                             }
                             if ($this->html_text_standard) {
                                 $this->html_text_standard->closeTextStyle(false, false);
                             }
                             if ($this->html_text_linked) {
                                 $this->html_text_linked->closeTextStyle(false, false);
                             }
                             $this->addToFallout("Picture formatting not yet implemented", true);
                             break;
                         case StyleTypePageBreak:
                             if ($this->odf_text_standard) {
                                 $this->odf_text_standard->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_text_only) {
                                 $this->odf_text_text_only->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_text_and_note_citations) {
                                 $this->odf_text_text_and_note_citations->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_notes) {
                                 $this->odf_text_notes->closeTextStyle(false, false);
                             }
                             if ($this->html_text_standard) {
                                 $this->html_text_standard->closeTextStyle(false, false);
                             }
                             if ($this->html_text_linked) {
                                 $this->html_text_linked->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_standard) {
                                 $this->odf_text_standard->newPageBreak();
                             }
                             if ($this->odf_text_text_only) {
                                 $this->odf_text_text_only->newPageBreak();
                             }
                             if ($this->odf_text_text_and_note_citations) {
                                 $this->odf_text_text_and_note_citations->newPageBreak();
                             }
                             if ($this->html_text_standard) {
                                 $this->html_text_standard->newPageBreak();
                             }
                             if ($this->html_text_linked) {
                                 $this->html_text_linked->newPageBreak();
                             }
                             if (isset($this->text_text)) {
                                 $this->text_text->paragraph();
                             }
                             break;
                         case StyleTypeTableElement:
                             if ($this->odf_text_standard) {
                                 $this->odf_text_standard->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_text_only) {
                                 $this->odf_text_text_only->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_text_and_note_citations) {
                                 $this->odf_text_text_and_note_citations->closeTextStyle(false, false);
                             }
                             if ($this->odf_text_notes) {
                                 $this->odf_text_notes->closeTextStyle(false, false);
                             }
                             if ($this->html_text_standard) {
                                 $this->html_text_standard->closeTextStyle(false, false);
                             }
                             if ($this->html_text_linked) {
                                 $this->html_text_linked->closeTextStyle(false, false);
                             }
                             switch ($style['subtype']) {
                                 case TableElementSubtypeRow:
                                     $this->addToFallout("Table elements not yet implemented", false);
                                     break;
                                 case TableElementSubtypeHeading:
                                 case TableElementSubtypeCell:
                                     $this->newParagraph($style, false);
                                     break;
                                 default:
                                     break;
                             }
                             // UserInt1TableColumnNumber:
                             break;
                         case StyleTypeWordlistElement:
                             switch ($style['subtype']) {
                                 case WorListElementSubtypeWordlistGlossaryDictionary:
                                     if ($isOpeningMarker) {
                                         $this->addToWordList($this->wordListGlossaryDictionary);
                                     }
                                     break;
                                 case WorListElementSubtypeHebrewWordlistEntry:
                                     if ($isOpeningMarker) {
                                         $this->addToWordList($this->hebrewWordList);
                                     }
                                     break;
                                 case WorListElementSubtypeGreekWordlistEntry:
                                     if ($isOpeningMarker) {
                                         $this->addToWordList($this->greekWordList);
                                     }
                                     break;
                                 case WorListElementSubtypeSubjectIndexEntry:
                                     if ($isOpeningMarker) {
                                         $this->addToWordList($this->subjectIndex);
                                     }
                                     break;
                                 default:
                                     if ($isOpeningMarker) {
                                         $this->addToFallout("Unknown word list marker \\{$marker}", false);
                                     }
                                     break;
                             }
                             // UserString1WordListEntryAddition:
                             break;
                         default:
                             // This marker is not yet implemented. Add to fallout, plus any text that follows.
                             $this->addToFallout("Marker not yet implemented \\{$marker}, possible formatting error:", true);
                             break;
                     }
                 } else {
                     // Here is an unknown marker. Add to fallout, plus any text that follows.
                     $this->addToFallout("Unknown marker \\{$marker}, formatting error:", true);
                 }
             } else {
                 // Here is no marker. Treat it as text.
                 if ($this->odf_text_standard) {
                     $this->odf_text_standard->addText($currentItem);
                 }
                 if ($this->odf_text_text_only) {
                     $this->odf_text_text_only->addText($currentItem);
                 }
                 if ($this->odf_text_text_and_note_citations) {
                     $this->odf_text_text_and_note_citations->addText($currentItem);
                 }
                 if ($this->html_text_standard) {
                     $this->html_text_standard->addText($currentItem);
                 }
                 if ($this->html_text_linked) {
                     $this->html_text_linked->addText($currentItem);
                 }
                 if ($this->onlinebible_text) {
                     $this->onlinebible_text->addText($currentItem);
                 }
                 if ($this->esword_text) {
                     $this->esword_text->addText($currentItem);
                 }
                 if (isset($this->text_text)) {
                     $this->text_text->text($currentItem);
                 }
                 if (is_array($this->verses_headings) && $this->heading_started) {
                     if (!isset($this->verses_headings[$this->currentVerseNumber])) {
                         $this->verses_headings[$this->currentVerseNumber] = "";
                     }
                     $this->verses_headings[$this->currentVerseNumber] .= $currentItem;
                 }
                 if (is_array($this->verses_text) && $this->text_started) {
                     if (isset($this->verses_text[$this->currentVerseNumber])) {
                         $this->verses_text[$this->currentVerseNumber] .= $currentItem;
                     } else {
                         // The verse text straight after the \v starts with an enSpace. Remove it.
                         $item = str_replace(Filter_Character::enSpace(), " ", $currentItem);
                         $this->verses_text[$this->currentVerseNumber] = ltrim($item);
                         unset($item);
                     }
                 }
             }
         }
     }
 }
示例#13
0
 public static function queueAll($now)
 {
     $database_config_bible = Database_Config_Bible::getInstance();
     $database_bibles = Database_Bibles::getInstance();
     $database_config_general = Database_Config_General::getInstance();
     $bibles = $database_bibles->getBibles();
     foreach ($bibles as $bible) {
         if ($database_config_bible->getRemoteRepositoryUrl($bible) != "") {
             if ($database_config_bible->getRepeatSendReceive($bible) || $now) {
                 self::queuebible($bible);
             }
         }
     }
 }
示例#14
0
文件: css.php 项目: alerque/bibledit
 public function customize($bible)
 {
     $database_config_bible = Database_Config_Bible::getInstance();
     $class = Filter_CustomCSS::getClass($bible);
     $font = $database_config_bible->getTextFont($bible);
     $uploaded_font = Fonts_Logic::fontExists($font);
     $font = Fonts_Logic::getFontPath($font);
     $direction = $database_config_bible->getTextDirection($bible);
     $css = Filter_CustomCSS::getCss($class, $font, $direction);
     if ($uploaded_font) {
         $css = str_replace("../fonts/", "", $css);
     }
     $this->css[] = $css;
 }
示例#15
0
function processIdentifiers($user, $bible, $book, $chapter, $oldId, $newId, &$email)
{
    if ($oldId != 0) {
        $database_modifications = Database_Modifications::getInstance();
        $database_config_user = Database_Config_User::getInstance();
        $database_config_bible = Database_Config_Bible::getInstance();
        $database_bibles = Database_Bibles::getInstance();
        $database_history = Database_History::getInstance();
        $stylesheet = $database_config_bible->getExportStylesheet($bible);
        $old_chapter_usfm = $database_modifications->getUserChapter($user, $bible, $book, $chapter, $oldId);
        $old_chapter_usfm = $old_chapter_usfm['oldtext'];
        $new_chapter_usfm = $database_modifications->getUserChapter($user, $bible, $book, $chapter, $newId);
        $new_chapter_usfm = $new_chapter_usfm['newtext'];
        $timestamp = $database_modifications->getUserTimestamp($user, $bible, $book, $chapter, $newId);
        $old_verse_numbers = Filter_Usfm::getVerseNumbers($old_chapter_usfm);
        $new_verse_numbers = Filter_Usfm::getVerseNumbers($new_chapter_usfm);
        $verses = array_merge($old_verse_numbers, $new_verse_numbers);
        $verses = array_unique($verses);
        sort($verses, SORT_NUMERIC);
        foreach ($verses as $verse) {
            $old_verse_usfm = Filter_Usfm::getVerseText($old_chapter_usfm, $verse);
            $new_verse_usfm = Filter_Usfm::getVerseText($new_chapter_usfm, $verse);
            if ($old_verse_usfm != $new_verse_usfm) {
                $filter_text_old = new Filter_Text($bible);
                $filter_text_new = new Filter_Text($bible);
                $filter_text_old->html_text_standard = new Html_Text(Locale_Translate::_("Bible"));
                $filter_text_new->html_text_standard = new Html_Text(Locale_Translate::_("Bible"));
                $filter_text_old->text_text = new Text_Text();
                $filter_text_new->text_text = new Text_Text();
                $filter_text_old->addUsfmCode($old_verse_usfm);
                $filter_text_new->addUsfmCode($new_verse_usfm);
                $filter_text_old->run($stylesheet);
                $filter_text_new->run($stylesheet);
                $old_html = $filter_text_old->html_text_standard->getInnerHtml();
                $new_html = $filter_text_new->html_text_standard->getInnerHtml();
                $old_text = $filter_text_old->text_text->get();
                $new_text = $filter_text_new->text_text->get();
                if ($old_text != $new_text) {
                    $modification = Filter_Diff::diff($old_text, $new_text);
                    $email .= "<div>";
                    $email .= Filter_Books::passageDisplay($book, $chapter, $verse);
                    $email .= " ";
                    $email .= $modification;
                    $email .= "</div>";
                    if ($database_config_user->getUserUserChangesNotificationsOnline($user)) {
                        $changeNotificationUsers = array($user);
                        $database_modifications->recordNotification($changeNotificationUsers, "☺", $bible, $book, $chapter, $verse, $old_html, $modification, $new_html);
                    }
                    $database_history->record($timestamp, $user, $bible, $book, $chapter, $verse, $old_html, $modification, $new_html);
                }
            }
        }
    }
}
示例#16
0
 public function testGetOrdered()
 {
     $database_bibles = Database_Bibles::getInstance();
     $database_config_bible = Database_Config_Bible::getInstance();
     $bible = "php unit";
     // No ordering.
     $database_bibles->createBible($bible);
     $database_bibles->storeChapter($bible, 1, 1, "data");
     $database_bibles->storeChapter($bible, 2, 1, "data");
     $database_bibles->storeChapter($bible, 3, 1, "data");
     $database_bibles->storeChapter($bible, 4, 1, "data");
     $database_bibles->storeChapter($bible, 5, 1, "data");
     $books = Filter_Books::getOrdered($bible);
     $standard = array(1, 2, 3, 4, 5);
     $this->assertEquals($standard, $books);
     // Existing books re-ordered.
     $database_config_bible->setBookOrder($bible, "1 3 2 5 4");
     $books = Filter_Books::getOrdered($bible);
     $standard = array(1, 3, 2, 5, 4);
     $this->assertEquals($standard, $books);
     // Some books ordered, and Bible has extra books: These are to be added to the end.
     $database_config_bible->setBookOrder($bible, "1 3 2");
     $books = Filter_Books::getOrdered($bible);
     $standard = array(1, 3, 2, 4, 5);
     $this->assertEquals($standard, $books);
     // More books ordered than in Bible: Remove the extra ones.
     $database_config_bible->setBookOrder($bible, "1 3 2 5 4 6");
     $books = Filter_Books::getOrdered($bible);
     $standard = array(1, 3, 2, 5, 4);
     $this->assertEquals($standard, $books);
 }
<?php

/*
Copyright (©) 2003-2014 Teus Benschop.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
require_once "../bootstrap/bootstrap.php";
page_access_level(Filter_Roles::ADMIN_LEVEL);
Assets_Page::header(Locale_Translate::_("Collaboration"));
$view = new Assets_View(__FILE__);
$object = $_GET['object'];
$view->view->object = $object;
$database_config_bible = Database_Config_Bible::getInstance();
$url = $database_config_bible->getRemoteRepositoryUrl($object);
$directory = Filter_Git::git_directory($object);
$view->render("collaboration_repo_data.php");
Assets_Page::footer();
示例#18
0
 public function updateSearchFields($name, $book, $chapter)
 {
     $database_bibles = Database_Bibles::getInstance();
     $database_config_bible = Database_Config_Bible::getInstance();
     $usfm = $database_bibles->getChapter($name, $book, $chapter);
     $stylesheet = $database_config_bible->getExportStylesheet($name);
     // Data to store.
     $usfmraw = array();
     $usfmlower = array();
     $plainraw = array();
     $plainlower = array();
     // Get the verses in the chapter.
     $verses = Filter_Usfm::getVerseNumbers($usfm);
     $verses = array_unique($verses);
     sort($verses, SORT_NUMERIC);
     // One column contains the raw USFM as it is, and another one the lowercase text.
     foreach ($verses as $verse) {
         $raw = Filter_Usfm::getVerseText($usfm, $verse);
         $lower = mb_convert_case($raw, MB_CASE_LOWER);
         $usfmraw[$verse] = $raw;
         $usfmlower[$verse] = $lower;
     }
     // Text filter for getting the plain text.
     $filter_text = new Filter_Text($name);
     $filter_text->text_text = new Text_Text();
     $filter_text->initializeHeadingsAndTextPerVerse();
     $filter_text->addUsfmCode($usfm);
     $filter_text->run($stylesheet);
     // Get the clean verse texts.
     $texts = $filter_text->getVersesText();
     foreach ($texts as $verse => $text) {
         if (!isset($plainraw[$verse])) {
             $plainraw[$verse] = "";
         }
         $plainraw[$verse] .= "{$text}\n";
     }
     // Add any clean headings.
     $headings = $filter_text->verses_headings;
     foreach ($headings as $verse => $heading) {
         if (!isset($plainraw[$verse])) {
             $plainraw[$verse] = "";
         }
         $plainraw[$verse] .= "{$heading}\n";
     }
     // Create the lower case plain text.
     foreach ($plainraw as $verse => $raw) {
         $plainlower[$verse] = mb_convert_case($raw, MB_CASE_LOWER);
     }
     // Get all possible verses.
     $allverses = array_merge(array_keys($usfmraw), array_keys($plainraw));
     $allverses = array_unique($allverses);
     // Store everything.
     Database_SQLite::exec($this->db, "BEGIN;");
     $name = Database_SQLiteInjection::no($name);
     $book = Database_SQLiteInjection::no($book);
     $chapter = Database_SQLiteInjection::no($chapter);
     $query = "DELETE FROM bibles WHERE bible = '{$name}' AND book = {$book} AND chapter = {$chapter};";
     Database_SQLite::exec($this->db, $query);
     foreach ($allverses as $verse) {
         if ($verse == "") {
             $verse = 0;
         }
         $verse = (int) $verse;
         @($ur = Database_SQLiteInjection::no($usfmraw[$verse]));
         @($ul = Database_SQLiteInjection::no($usfmlower[$verse]));
         @($pr = Database_SQLiteInjection::no($plainraw[$verse]));
         @($pl = Database_SQLiteInjection::no($plainlower[$verse]));
         $query = "INSERT INTO bibles (bible, book, chapter, verse, usfmraw, usfmlower, plainraw, plainlower) VALUES ('{$name}', {$book}, {$chapter}, {$verse}, '{$ur}', '{$ul}', '{$pr}', '{$pl}');";
         Database_SQLite::exec($this->db, $query);
     }
     Database_SQLite::exec($this->db, "COMMIT;");
 }