/** * Returns existing instance of HTML_Header or creates and return new * * @static * @return Html_Header */ public static function instance() { if (Html_Header::$instance === NULL) { Html_Header::$instance = new Html_Header(); } return Html_Header::$instance; }
$html_text_rich_book_index = new Html_Text($bibleBookText); $htmlHeader = new Html_Header($html_text_rich_book_index); $htmlHeader->searchBackLink($backLinkPath . Filter_Paths::htmlFileNameBible("", $book), Locale_Translate::_("Go back to") . " " . $bibleBookText); $htmlHeader->create(array(array($bible, Filter_Paths::htmlFileNameBible()), array($database_books->getEnglishFromId($book), Filter_Paths::htmlFileNameBible()))); $html_text_rich_book_index->newParagraph("navigationbar"); $html_text_rich_book_index->addText("|"); // Go through the chapters of this book. $chapters = $database_bibles->getChapters($bible, $book); foreach ($chapters as $chapter) { // The text filter for this chapter. $filter_text_chapter = new Filter_Text($bible); $usfm = $database_bibles->getChapter($bible, $book, $chapter); $usfm = trim($usfm); // Use small chunks of USFM at a time for much better performance. $filter_text_chapter->addUsfmCode($usfm); // Interlinked web data for one chapter. $filter_text_chapter->html_text_linked = new Html_Text(Locale_Translate::_("Bible")); $filter_text_chapter->html_text_linked->customClass = Filter_CustomCSS::getClass($bible); // Create breadcrumbs for the chapter. $htmlHeader = new Html_Header($filter_text_chapter->html_text_linked); $htmlHeader->searchBackLink($backLinkPath . Filter_Paths::htmlFileNameBible("", $book, $chapter), Locale_Translate::_("Go back to") . " " . $bibleBookText . " " . $chapter); $htmlHeader->create(array(array($bible, Filter_Paths::htmlFileNameBible()), array($database_books->getEnglishFromId($book), Filter_Paths::htmlFileNameBible()), array($chapter, Filter_Paths::htmlFileNameBible("", $book)))); // Create interlinked html for the chapter. $filter_text_chapter->run($stylesheet); $filter_text_chapter->html_text_linked->save(Filter_Paths::htmlFileNameBible($directory, $book, $chapter)); $html_text_rich_book_index->addLink($html_text_rich_book_index->currentPDomElement, Filter_Paths::htmlFileNameBible("", $book, $chapter), "", $chapter, "", " " . $chapter . " "); $html_text_rich_book_index->addText("|"); } // Save the book index. $html_text_rich_book_index->save(Filter_Paths::htmlFileNameBible($directory, $book)); $database_logs->log(Locale_Translate::_("Exported to web") . " {$bible} " . Export_Logic::baseBookFileName($book), Filter_Roles::TRANSLATOR_LEVEL);
$indexFile = "{$directory}/index.html"; $index00 = "{$directory}/00_index.html"; $filecss = "{$directory}/stylesheet.css"; $database_logs = Database_Logs::getInstance(); $database_config_bible = Database_Config_Bible::getInstance(); $database_bibles = Database_Bibles::getInstance(); $database_books = Database_Books::getInstance(); $stylesheet = $database_config_bible->getExportStylesheet($bible); // Create stylesheet. $styles_sheets = new Styles_Sheets(); $styles_sheets->create($stylesheet, $filecss, false, $bible); $backLinkPath = Export_Logic::webBackLinkDirectory($bible); // Main index file. $html_text_rich_bible_index = new Html_Text($bible); // On top are the breadcrumbs, starting with a clickable Bible name. $htmlHeader = new Html_Header($html_text_rich_bible_index); $htmlHeader->searchBackLink($backLinkPath . Filter_Paths::htmlFileNameBible(), Locale_Translate::_("Go back to Bible")); $htmlHeader->create(array(array($bible, Filter_Paths::htmlFileNameBible()))); // Prepare for the list of books in de html index file. $html_text_rich_bible_index->newParagraph("navigationbar"); $html_text_rich_bible_index->addText(" |"); // Go through the Bible books. $books = $database_bibles->getBooks($bible); foreach ($books as $book) { // Add this book to the main web index. $html_text_rich_bible_index->addLink($html_text_rich_bible_index->currentPDomElement, Filter_Paths::htmlFileNameBible("", $book), "", $database_books->getEnglishFromId($book), "", " " . $database_books->getEnglishFromId($book) . " "); $html_text_rich_bible_index->addText("|"); } // Save index file for the interlinked web export. $database_logs->log("exports: Create index file for interlinked Web"); $html_text_rich_bible_index->save($indexFile);