Ejemplo n.º 1
0
 public function testImport()
 {
     $this->assertEquals(array(), Filter_Usfm::import("", "Standard"));
     $this->assertEquals(array(array(33, 0, "\\id MIC"), array(33, 1, "\\c 1\n\\s Heading\n\\p\n\\v 1 Verse one.")), Filter_Usfm::import("\\id MIC\n\\c 1\n\\s Heading\n\\p\n\\v 1 Verse one.", "Standard"));
 }
Ejemplo n.º 2
0
}
// Get the old chapter USFM into an array of verse => USFM fragment.
$usfmString = $database_bibles->getChapter($bible, $book, $chapter);
$verses = Filter_Usfm::getVerseNumbers($usfmString);
$verses = array_unique($verses);
sort($verses, SORT_NUMERIC);
$usfmArray = array();
foreach ($verses as $vs) {
    $usfmArray[$vs] = Filter_Usfm::getVerseText($usfmString, $vs);
}
// Store the verse USFM in the array.
$usfmArray[$verse] = $usfm;
// Create the updated chapter USFM as a string.
$usfm = implode("\n", $usfmArray);
$stylesheet = $database_config_user->getStylesheet();
$book_chapter_text = Filter_Usfm::import($usfm, $stylesheet);
foreach ($book_chapter_text as $data) {
    $book_number = $data[0];
    $chapter_number = $data[1];
    $chapter_data_to_save = $data[2];
    if (($book_number == $book || $book_number == 0) && $chapter_number == $chapter) {
        // Collect some data about the changes for this user.
        $username = $session_logic->currentUser();
        $oldID = $database_bibles->getChapterId($bible, $book, $chapter);
        $oldText = $database_bibles->getChapter($bible, $book, $chapter);
        // Safely store the chapter.
        $saved = Filter_Bibles::safeStoreChapter($bible, $book, $chapter, $chapter_data_to_save);
        if ($saved) {
            // Store details for the user's changes.
            $newID = $database_bibles->getChapterId($bible, $book, $chapter);
            $newText = $chapter_data_to_save;
Ejemplo n.º 3
0
\v 17 Obey them that have the rule over you, and submit yourselves: for they watch for your souls, as they that must give account, that they may do it with joy, and not with grief: for that\add is\add* unprofitable for you.
\p
\v 18 Pray for us: for we trust we have a good conscience, in all things willing to live honestly.
\v 19 But I beseech \add you\add* the rather to do this, that I may be restored to you the sooner.
\v 20 Now the God of peace, that brought again from the dead our Lord Jesus, that great shepherd of the sheep, through the blood of the everlasting covenant,
\v 21 Make you perfect in every good work to do his will, working in you that which is wellpleasing in his sight, through JesusChrist; to whom \add be\add* glory for ever and ever. Amen.
\v 22 And I beseech you, brethren, suffer the word of exhortation: for I have written a letter unto you in few words.
\v 23 Know ye that \add our\add* brother Timothy is set at liberty; with whom, if he come shortly, I will see you.
\p
\v 24 Salute all them that have the rule over you, and all the saints. They of Italy salute you.
\p
\v 25 Grace \add be\add* with you all. Amen.
EOD;
$data[] = $usfm;
foreach ($data as $usfm) {
    $book_chapter_text = Filter_Usfm::import($usfm, "Standard");
    foreach ($book_chapter_text as $data) {
        $book_number = $data[0];
        $chapter_number = $data[1];
        $chapter_data = $data[2];
        if ($book_number > 0) {
            Bible_Logic::storeChapter("KJV", $book_number, $chapter_number, $chapter_data);
        }
    }
}
// Clean out nearly empty chapters from the Bibles.
$bibles = $database_bibles->getBibles();
foreach ($bibles as $bible) {
    $books = $database_bibles->getBooks($bible);
    foreach ($books as $book) {
        $chapters = $database_bibles->getChapters($bible, $book);